package com.sctvcloud.beichuan.ui.adapter.holder;

import android.content.Context;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Pair;
import android.view.View;
import android.widget.ImageView;

import com.gridsum.tracker.GridsumWebDissector;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.beichuan.R;
import com.sctvcloud.beichuan.beans.HomeListItem;
import com.sctvcloud.beichuan.beans.NewsItem;
import com.sctvcloud.beichuan.ui.adapter.HomeHotVideoContentAdapter;
import com.sctvcloud.beichuan.ui.utils.SkipUtil;
import com.sctvcloud.beichuan.ui.utils.UiListMarginUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 首页 精选--功能入口
 */
public class HomeEntryHolder extends BaseAbsHolder<HomeListItem> {

    @BindView(R.id.livelihood_demands)
    protected ImageView livelihoodDemands;
    @BindView(R.id.report_prize)
    protected ImageView reportPrize;
    @BindView(R.id.important_publicity)
    protected ImageView importantPublicity;
    @BindView(R.id.sign_everyday)
    protected ImageView signEveryday;
    @BindView(R.id.weiyuan_today)
    protected ImageView weiyuanToday;


    private HomeListItem homeListItem;
    private OnEntryClickListener entryClickListener;

    public HomeEntryHolder(Context context, View itemView, OnEntryClickListener listener) {
        super(context, itemView);
        this.entryClickListener = listener;
    }

    @Override
    public void setData(HomeListItem newsItem) {

    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @OnClick(value = {R.id.livelihood_demands, R.id.report_prize, R.id.important_publicity, R.id.sign_everyday, R.id.weiyuan_today})
    public void onClick(View view) {
        if (null != entryClickListener) {
            if (view.getId() == R.id.livelihood_demands) {
                entryClickListener.OnEntryClick(1);
            } else if (view.getId() == R.id.report_prize) {
                entryClickListener.OnEntryClick(2);
            } else if (view.getId() == R.id.important_publicity) {
                entryClickListener.OnEntryClick(3);
            } else if (view.getId() == R.id.sign_everyday) {
                entryClickListener.OnEntryClick(4);
            } else if (view.getId() == R.id.weiyuan_today) {
                entryClickListener.OnEntryClick(5);
            }
        }
    }

    public void setEntryClickListener(OnEntryClickListener entryClickListener) {
        this.entryClickListener = entryClickListener;
    }

    public interface OnEntryClickListener {
        void OnEntryClick(int clickPosition);
    }
}
